// pages/javaee/javaee.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    jump:'',
    mapUrl: "",
    list:[], 
    page:1,
    count:5,
    flag:true,
  },
  jump:function(){
    wx.navigateTo({
     url: '../question/question',
     success: function(res) {
  
     },
     fail: function(res) {
  
     },
     complete: function(res) {
  
     },
    })
   },
  onLoad: function () {
    this.setData({
      mapUrl: "https://vdse.bdstatic.com//192d9a98d782d9c74c96f09db9378d93.mp4"
    })
  },
  onLoad: function (options) {
    this.getListData()
},

getListData(){
  this.setData({flag:false})
  console.log('加载中')
  wx.showLoading({
  title: '加载中...',
  })
  let {page,count,list} = this.data
  wx.request({
    url: urls.default.top,
      header:{
      "content-type":"application/text"
    },
  data:{
    start:(page-1)*count,
    count:5,
  },
  success:res=>{
    if(res.statusCode===200){
      page++;
      list = list.concat(res.data.subjects)
      this.setData({
        list:list,
        page,
        flag:true 
      })
    }
    wx.hideLoading()
  }
  })
  },
  onReachBottom(){
   if(this.data.flag){
      this.getListData()
    }
  }
})